var i=0;
	function dept(){
		if(i==0){
			document.getElementById("dept_child").style.display="block";
			i=1;
		}else{
			document.getElementById("dept_child").style.display="none";
			i=0;
		}
	}
	
	function job(){
		if(i==0){
			document.getElementById("job_child").style.display="block";
			i=1;
		}else{
			document.getElementById("job_child").style.display="none";
			i=0;
		}
	}
	function employ(){
		if(i==0){
			document.getElementById("employ_child").style.display="block";
			i=1;
		}else{
			document.getElementById("employ_child").style.display="none";
			i=0;
		}
	}
	
	function ajax(params) {

		var xmlhttp;
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		} else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}

		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4) {
				if (params.callback) {
					params.callback(xmlhttp);
				}
			}
		};

		var method = params.method ? params.method : "GET";
		var asynch = params.asynch ? true : params.asynch;

		xmlhttp.open(method, params.url, params.asynch);
		if (method.toLowerCase() == 'post') {
			xmlhttp.setRequestHeader("Content-Type",
					"application/x-www-form-urlencoded");
		}

		if (params.params) {
			var p = [];
			for (key in params.params) {
				p.push(key + "=" + params.params[key]);
			}
			xmlhttp.send(p.join("&"));
		} else {
			xmlhttp.send(null);
		}
	}
	
	function getjob() {
		var tb=document.getElementById("tb");
		var trs=tb.getElementsByTagName("tr");
		tb.align="center";
		ajax({
			url : "job" ,
			callback : function(xhr) {
				if (window.JSON) {
					data = JSON.parse(xhr.response);
				} else {
					data = eval("(" + xhr.response + ")");
				}
				
				if(data&&!trs.length>0){
					for(var i = 0;i< data.length;i++){
						var item = data[i];
						var tr  = document.createElement("tr");
						var td1 = document.createElement("td");
						var td2 = document.createElement("td");
						var td3 = document.createElement("td");
						var td4 = document.createElement("td");
						var td5 = document.createElement("td");
						
						var a1 = document.createElement("a");
						var a2 = document.createElement("a");
						var input = document.createElement("input");
						
						input.type="checkbox";
						input.class="ui checkbox";			
						a1.href="index.jsp";
						a2.href="index.jsp";
						td1.innerHTML = item.positionName;
						td2.innerHTML = item.positionDescription;
						a1.innerHTML = "删除";
						a2.innerHTML = "修改";
						
						td3.appendChild(a1);
						td4.appendChild(a2);
						td5.appendChild(input);
						
						tr.appendChild(td1);
						tr.appendChild(td2);
						tr.appendChild(td3);
						tr.appendChild(td4);
						tr.appendChild(td5);
						
						tb.appendChild(tr);
					}
				}
			}
		});
	}